//==================================================================
/// RSLC_Defs_OpConvert.h
///
/// Created by Davide Pasca - 2009/7/16
/// See the file "license.txt" that comes with this project for
/// copyright info. 
//==================================================================

#ifndef RSLC_DEFS_OPCONVERT_H
#define RSLC_DEFS_OPCONVERT_H

#include "RSLC_Token.h"

//==================================================================
namespace RSLC
{

//==================================================================
struct BiOpConvertRule 
{
	TokenID	mOper;
	VarType	mResType;
	VarType	mLType;
	VarType	mRType;
};

//==================================================================
static BiOpConvertRule	_sBiOpConvertRules[] =
{
	T_OP_ASSIGN		,	VT_VECTOR	,	VT_VECTOR	,	VT_VECTOR	,
	T_OP_ASSIGN		,	VT_VECTOR	,	VT_VECTOR	,	VT_FLOAT	,
	T_OP_ASSIGN		,	VT_COLOR	,	VT_COLOR	,	VT_COLOR	,
	T_OP_ASSIGN		,	VT_COLOR	,	VT_COLOR	,	VT_FLOAT	,
	T_OP_ASSIGN		,	VT_FLOAT	,	VT_FLOAT	,	VT_FLOAT	,
	T_OP_ASSIGN		,	VT_MATRIX	,	VT_MATRIX	,	VT_MATRIX	,
	T_OP_ASSIGN		,	VT_STRING	,	VT_STRING	,	VT_STRING	,
	T_OP_ASSIGN		,	VT_BOOL		,	VT_BOOL		,	VT_BOOL		,


	T_OP_PLUSASS	,	VT_VECTOR	,	VT_VECTOR	,	VT_VECTOR	,
	T_OP_PLUSASS	,	VT_VECTOR	,	VT_VECTOR	,	VT_FLOAT	,
	T_OP_PLUSASS	,	VT_COLOR	,	VT_COLOR	,	VT_COLOR	,
	T_OP_PLUSASS	,	VT_COLOR	,	VT_COLOR	,	VT_FLOAT	,
	T_OP_PLUSASS	,	VT_FLOAT	,	VT_FLOAT	,	VT_FLOAT	,
	T_OP_PLUSASS	,	VT_MATRIX	,	VT_MATRIX	,	VT_MATRIX	,
	T_OP_PLUSASS	,	VT_MATRIX	,	VT_MATRIX	,	VT_FLOAT	,

	T_OP_PLUS		,	VT_VECTOR	,	VT_VECTOR	,	VT_VECTOR	,
	T_OP_PLUS		,	VT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LOAT	,
	T_OP_NEQ		,	VT_BOOL,	VT_POINT	,	VT_POINT	,
	T_OP_NEQ		,	VT_BOOL,	VT_COLOR	,	VT_COLOR	,
	T_OP_NEQ		,	VT_BOOL,	VT_VECTOR	,	VT_VECTOR	,
	T_OP_NEQ		,	VT_BOOL,	VT_NORMAL	,	VT_NORMAL	,
	T_OP_NEQ		,	VT_BOOL,	VT_MATRIX	,	VT_MATRIX	,
	T_OP_NEQ		,	VT_BOOL,	VT_STRING	,	VT_STRING	,
	T_OP_NEQ		,	VT_BOOL,	VT_BOOL		,	VT_BOOL		,

	// array indicization.. can only indicize using "float"
	// [ 
	T_OP_LFT_SQ_BRACKET,	VT_FLOAT	,	VT_FLOAT	,	VT_FLOAT	,
	T_OP_LFT_SQ_BRACKET,	VT_POINT	,	VT_POINT	,	VT_FLOAT	,
	T_OP_LFT_SQ_BRACKET,	VT_COLOR	,	VT_COLOR	,	VT_FLOAT	,
	T_OP_LFT_SQ_BRACKET,	VT_VECTOR	,	VT_VECTOR	,	VT_FLOAT	,
	T_OP_LFT_SQ_BRACKET,	VT_NORMAL	,	VT_NORMAL	,	VT_FLOAT	,
	T_OP_LFT_SQ_BRACKET,	VT_MATRIX	,	VT_MATRIX	,	VT_FLOAT	,
	T_OP_LFT_SQ_BRACKET,	VT_STRING	,	VT_STRING	,	VT_FLOAT	,
	T_OP_LFT_SQ_BRACKET,	VT_BOOL		,	VT_BOOL		,	VT_FLOAT	,
};

//==================================================================
}

#endif
